Component({
  options: {
    multipleSlots: true,
    addGlobalClass: true
  },
  data: {
    show: false,
    icon: "success",
    msg: "提示",
    type: "toast"
  },
  methods: {
    show(options) {
      let {icon, msg, time} = options;
      let data = {msg: msg, show: true}
      if (icon) {
        data['icon'] = icon
      }
      if (!time) {
        time = 2500
      }
      this.setData(data);
      setTimeout(() => {
        this.setData({show: false})
      }, time)
    }
  }
})

